<template>
	<view>
		<trend ref="trend" v-if="PageCur=='trend'" />
		<ucenter ref="ucenter" v-if="PageCur=='ucenter'" />
		
		<view class="cu-tabbar-height"></view>
		<view class="cu-bar tabbar bg-white shadow foot">
			<view class="action" @click="NavChange" data-cur="trend">
				<view class="action " :class="PageCur=='trend' ? 'text-red':''">
					<view class="cuIcon-homefill"></view> 首页
				</view>
			</view>
			<view class="action" @click="NavChange" data-cur="ucenter">
				<view class="action" :class="PageCur=='ucenter' ? 'text-red':''">
					<view class="cuIcon-peoplefill"></view> 我的
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import trend from "./trend/main.vue";
	import ucenter from "./ucenter.vue";

	export default {
		components: {
			trend,
			ucenter
		},
		// mixins: [share],
		data() {
			return {
				PageCur: "trend",
			};
		},
		onPullDownRefresh() {
			if (this.PageCur === 'trend') {
				this.$refs.trend.getData()
			}
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		onShow() {},
		onReachBottom() {
			if (this.PageCur === 'trend') {
				this.$refs.trend.init()
			}
		},
		onLoad(e) {
			this.$nextTick(() => {
				this.$refs.trend.init()
			})
		},
		methods: {
			NavChange: function(e) {
				this.PageCur = e.currentTarget.dataset.cur;
				this.$nextTick(() => {
					this.$refs[this.PageCur].init()
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>